package cn.ibizlab.odoo.core.odoo_hr.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet;
import cn.ibizlab.odoo.core.odoo_hr.domain.Hr_expense_sheet;
import cn.ibizlab.odoo.core.odoo_hr.filter.Hr_expense_sheetSearchContext;
import cn.ibizlab.odoo.core.odoo_hr.service.IHr_expense_sheetService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[费用报表] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Hr_expense_sheetServiceImpl implements IHr_expense_sheetService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Ihr_expense_sheetClientService hr_expense_sheetClientService;

    @Override
    public boolean update(Hr_expense_sheet hr_expense_sheet) {
        boolean bOk = false ;
        Ihr_expense_sheet clientModel = this.convert2Model(hr_expense_sheet,null);
        hr_expense_sheetClientService.update(clientModel) ;
        this.convert2Domain(clientModel,hr_expense_sheet) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public Hr_expense_sheet get(Integer id) {
        Ihr_expense_sheet clientModel = hr_expense_sheetClientService.createModel();
        clientModel.setId(id);
        hr_expense_sheetClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Hr_expense_sheet get(Hr_expense_sheet hr_expense_sheet) {
        Hr_expense_sheet rethr_expense_sheet = this.get(hr_expense_sheet.getId()) ;
    	BeanCopier copier=BeanCopier.create(rethr_expense_sheet.getClass(), hr_expense_sheet.getClass(), false);
        copier.copy(rethr_expense_sheet, hr_expense_sheet, null);
        return hr_expense_sheet ;
    }

    @Override
    public void createBatch(List<Hr_expense_sheet> hr_expense_sheets, int batchSize) {

                        //hr_expense_sheetClientService.createBatch(hr_expense_sheets,batchSize) ;

    }

    @Override
    public void updateBatch(List<Hr_expense_sheet> hr_expense_sheets, int batchSize) {

        //hr_expense_sheetClientService.updateBatch(hr_expense_sheets,batchSize) ;

    }

    @Override
    public boolean create(Hr_expense_sheet hr_expense_sheet) {
        boolean bOk = false ;
        Ihr_expense_sheet clientModel = this.convert2Model(hr_expense_sheet,null);
        hr_expense_sheetClientService.create(clientModel) ;
        this.convert2Domain(clientModel,hr_expense_sheet);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //hr_expense_sheetClientService.removeBatch(hr_expense_sheets) ;

    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Ihr_expense_sheet clientModel = hr_expense_sheetClientService.createModel();
        clientModel.setId(id);
        hr_expense_sheetClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Hr_expense_sheet> searchDefault(Hr_expense_sheetSearchContext context) {
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据日记账查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_bank_journal(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据日记账查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_journal(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据凭证录入查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_account_move(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据HR 部门查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_department(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据员工查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_employee(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_company(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据币种查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_currency(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_address(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_create(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_user(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Hr_expense_sheet> selectByOdoo_write(Integer id){
        Hr_expense_sheetSearchContext context = new Hr_expense_sheetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Hr_expense_sheet> list = new ArrayList<Hr_expense_sheet>();
        Page<cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet> clientModelList = hr_expense_sheetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ihr_expense_sheet clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Hr_expense_sheet>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Ihr_expense_sheet convert2Model(Hr_expense_sheet domain , Ihr_expense_sheet model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = hr_expense_sheetClientService.createModel() ;
        }

         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getCan_resetDirtyFlag())
            model.setCan_reset(domain.getCan_reset());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getActivity_type_idDirtyFlag())
            model.setActivity_type_id(domain.getActivity_type_id());
         if(domain.getAttachment_numberDirtyFlag())
            model.setAttachment_number(domain.getAttachment_number());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getIs_multiple_currencyDirtyFlag())
            model.setIs_multiple_currency(domain.getIs_multiple_currency());
         if(domain.getActivity_stateDirtyFlag())
            model.setActivity_state(domain.getActivity_state());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getPayment_modeDirtyFlag())
            model.setPayment_mode(domain.getPayment_mode());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getActivity_user_idDirtyFlag())
            model.setActivity_user_id(domain.getActivity_user_id());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getExpense_line_idsDirtyFlag())
            model.setExpense_line_ids(domain.getExpense_line_ids());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getAccounting_dateDirtyFlag())
            model.setAccounting_date(domain.getAccounting_date());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getActivity_idsDirtyFlag())
            model.setActivity_ids(domain.getActivity_ids());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getTotal_amountDirtyFlag())
            model.setTotal_amount(domain.getTotal_amount());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getActivity_summaryDirtyFlag())
            model.setActivity_summary(domain.getActivity_summary());
         if(domain.getActivity_date_deadlineDirtyFlag())
            model.setActivity_date_deadline(domain.getActivity_date_deadline());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getJournal_id_textDirtyFlag())
            model.setJournal_id_text(domain.getJournal_id_text());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getDepartment_id_textDirtyFlag())
            model.setDepartment_id_text(domain.getDepartment_id_text());
         if(domain.getBank_journal_id_textDirtyFlag())
            model.setBank_journal_id_text(domain.getBank_journal_id_text());
         if(domain.getEmployee_id_textDirtyFlag())
            model.setEmployee_id_text(domain.getEmployee_id_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getAccount_move_id_textDirtyFlag())
            model.setAccount_move_id_text(domain.getAccount_move_id_text());
         if(domain.getCurrency_id_textDirtyFlag())
            model.setCurrency_id_text(domain.getCurrency_id_text());
         if(domain.getAddress_id_textDirtyFlag())
            model.setAddress_id_text(domain.getAddress_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getBank_journal_idDirtyFlag())
            model.setBank_journal_id(domain.getBank_journal_id());
         if(domain.getAccount_move_idDirtyFlag())
            model.setAccount_move_id(domain.getAccount_move_id());
         if(domain.getAddress_idDirtyFlag())
            model.setAddress_id(domain.getAddress_id());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getEmployee_idDirtyFlag())
            model.setEmployee_id(domain.getEmployee_id());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
         if(domain.getJournal_idDirtyFlag())
            model.setJournal_id(domain.getJournal_id());
         if(domain.getDepartment_idDirtyFlag())
            model.setDepartment_id(domain.getDepartment_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
        return model ;
    }

    public Hr_expense_sheet convert2Domain( Ihr_expense_sheet model ,Hr_expense_sheet domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Hr_expense_sheet();
        }

        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getCan_resetDirtyFlag())
            domain.setCan_reset(model.getCan_reset());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getActivity_type_idDirtyFlag())
            domain.setActivity_type_id(model.getActivity_type_id());
        if(model.getAttachment_numberDirtyFlag())
            domain.setAttachment_number(model.getAttachment_number());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getIs_multiple_currencyDirtyFlag())
            domain.setIs_multiple_currency(model.getIs_multiple_currency());
        if(model.getActivity_stateDirtyFlag())
            domain.setActivity_state(model.getActivity_state());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getPayment_modeDirtyFlag())
            domain.setPayment_mode(model.getPayment_mode());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getActivity_user_idDirtyFlag())
            domain.setActivity_user_id(model.getActivity_user_id());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getExpense_line_idsDirtyFlag())
            domain.setExpense_line_ids(model.getExpense_line_ids());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getAccounting_dateDirtyFlag())
            domain.setAccounting_date(model.getAccounting_date());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getActivity_idsDirtyFlag())
            domain.setActivity_ids(model.getActivity_ids());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getTotal_amountDirtyFlag())
            domain.setTotal_amount(model.getTotal_amount());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getActivity_summaryDirtyFlag())
            domain.setActivity_summary(model.getActivity_summary());
        if(model.getActivity_date_deadlineDirtyFlag())
            domain.setActivity_date_deadline(model.getActivity_date_deadline());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getJournal_id_textDirtyFlag())
            domain.setJournal_id_text(model.getJournal_id_text());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getDepartment_id_textDirtyFlag())
            domain.setDepartment_id_text(model.getDepartment_id_text());
        if(model.getBank_journal_id_textDirtyFlag())
            domain.setBank_journal_id_text(model.getBank_journal_id_text());
        if(model.getEmployee_id_textDirtyFlag())
            domain.setEmployee_id_text(model.getEmployee_id_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getAccount_move_id_textDirtyFlag())
            domain.setAccount_move_id_text(model.getAccount_move_id_text());
        if(model.getCurrency_id_textDirtyFlag())
            domain.setCurrency_id_text(model.getCurrency_id_text());
        if(model.getAddress_id_textDirtyFlag())
            domain.setAddress_id_text(model.getAddress_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getBank_journal_idDirtyFlag())
            domain.setBank_journal_id(model.getBank_journal_id());
        if(model.getAccount_move_idDirtyFlag())
            domain.setAccount_move_id(model.getAccount_move_id());
        if(model.getAddress_idDirtyFlag())
            domain.setAddress_id(model.getAddress_id());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getEmployee_idDirtyFlag())
            domain.setEmployee_id(model.getEmployee_id());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        if(model.getJournal_idDirtyFlag())
            domain.setJournal_id(model.getJournal_id());
        if(model.getDepartment_idDirtyFlag())
            domain.setDepartment_id(model.getDepartment_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        return domain ;
    }


}
